#ifndef __consultant_h__
#define __consultant_h__

#include <iostream>
#include <list>
#include <vector>
#include <cassert>
#include <algorithm>
#include <queue>
#include "disjointset.h"

using namespace std;

struct Edge
{
	int cost;
	int x, y;

	Edge() : x(-1), y(-1), cost(0) {}
	Edge(int x, int y, int cost) : x(x), y(y), cost(cost) {}

};

struct Node
{
	list< int > adjacency;
	int degree;

	Node() {}
	Node(int parent, int degree) : degree(degree){}
};

class Consultant
{
	int node_count;
	int edge_count;

	vector< Edge > edges;

	list< Edge > solution;
	int solution_cost;

	int master;

public:
	Consultant();
	~Consultant();

	void getInput();
	void solveA();
	void solveB();

	friend ostream& operator<<(ostream &os, const Consultant &c);

private:
	static bool edgeCompare(Edge e1, Edge e2);
};

ostream& operator<<(ostream &os, const Consultant &c);

#endif /* __consultant_h__ */